package factories;

import com.jme.scene.Controller;
import com.jmex.effects.particles.ParticleMesh;

public class ParticleRemoveController extends Controller {
	
	private static final long serialVersionUID = 1L;
	
	private float currentTime = 0;
	private ParticleMesh mesh;
	
	public ParticleRemoveController(ParticleMesh mesh) {
		this.mesh = mesh;
	}
	
	@Override
	public void update(float time) {
		currentTime += time;
		if(currentTime >= mesh.getMaximumLifeTime()) mesh.removeFromParent();
	}
}